# Copyright (c) 2008-2009 Mikhail Chernov 
#
# This file is part of dcExplorer.
#
# dcExplorer is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# dcExplorer is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with dcExplorer.  If not, see <http://www.gnu.org/licenses/>.

package Tools;
use strict;
use Settings;

sub formatPlanetName
{
	my ($x, $y, $name) = @_;
	return $name unless $Settings::HideCoordinates;
	my ($xf, $yf) = map { formatCoordinate($_) } ($x, $y);
	$name =~ s/$x/$xf/g;
	$name =~ s/$y/$yf/g;
	return $name;
}

sub formatCoordinate
{
	my $x = shift;
	return $x unless ($Settings::HideCoordinates);
	return sprintf("??%02d", $x % 100);
}

1;
